<template>
  <div class="header wrap">
    <div class="header-logo">
      <img src="../assets/img/indexLogo.6f8ac4f0.png" alt="" />
    </div>
    <div class="header-center">
      <ul>
        <li
          @click="fn('/home', 1)"
          :class="[$route.path == '/home' ? 'active' : '']"
        >
          首页
        </li>
        <li
          @click="fn('/goods', 2)"
          :class="[$route.path == '/goods' ? 'active' : '']"
        >
          全部商品
        </li>
        <li
          @click="fn('/user', 3)"
          :class="[$route.path == '/user' ? 'active' : '']"
        >
          个人中心
        </li>
        <li
          @click="fn('/mine', 4)"
          :class="[$route.path == '/mine' ? 'active' : '']"
        >
          我的订单
        </li>
        <li
          @click="fn('/free', 5)"
          :class="[$route.path == '/free' ? 'active' : '']"
        >
          专属福利
        </li>
      </ul>
    </div>
    <div class="header-search">
      <input type="text" placeholder="请输入关键字" v-model="searchVal" />
      <span class="rimg" @click="getSearch">
        <img src="../assets/img/search.png" alt="" />
      </span>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      searchVal: "",
    };
  },
  methods: {
    fn(path, num) {
      // console.log(path);
      this.$router.push(path);
      this.isActive = num;
    },
    getSearch() {
      this.$router.push(`/goods?keyword=${this.searchVal}`);
      console.log("22222");
    },
  },
};
</script>

<style lang="less" scoped>
.header {
  height: 118px;
  // background: pink;
  display: flex;
  justify-content: space-between;
  align-items: center;
  // .header-logo {
  // }
  .header-center {
    width: 500px;
    height: 16px;
    font-size: 16px;
    font-family: SourceHanSansSC;
    font-weight: 500;
    color: #242b39;
    line-height: 23px;
    font-weight: 500;
    ul {
      width: 100%;
      display: flex;
      justify-content: space-between;
    }
    .active {
      color: #0a328e;
    }
  }
  .header-search {
    display: flex;
    input {
      text-indent: 2em;
      width: 214px;
      height: 40px;
      border: 1px solid #dedede;
      border-radius: 20px 0px 0px 20px;
      box-sizing: border-box;
      outline: none;
    }
    .rimg {
      width: 50px;
      height: 40px;
      background: #0a328e;
      border-radius: 0px 20px 20px 0px;
      text-align: center;
      line-height: 40px;
    }
  }
}
</style>
